<div id="information">
<br /><br />
<?php
	$ImageDir="../site_pict/";
	$ImageThumb="../site_pict/thumbs/";
	$select_pict=mysql_query('SELECT * FROM images WHERE `to`="'.$_GET['name_g'].'"');
	if(mysql_num_rows($select_pict)==0){
       echo "<p style='margin-left: 5px; margin-right: 5px; position: relative; top: -10px; border: 2px dotted #3171a0; padding: 5px; font-weight: bold;'>Няма снимки към галерията!</p>";
	} else {
	while($row_pict=mysql_fetch_assoc($select_pict)){
	   if($_SESSION['username']=="admin"){
	   echo "<img src='".$ImageThumb."/".$row_pict['id'].".jpg."."' alt='".$row_pict['id']."' style='margin-left: 0px; margin-top: 5px; border: 3px solid gray; border-radius: 5px; -moz-border-radius: 5px; box-shadow: 2px 3px 3px #000; position: relative; right: -10px;'/>";
	   echo "<a href='view_gallery.php?mode=delete&amp;id=$row_pict[id]&amp;name=".$_GET['name']."'><img src='img/user_icon.png' alt='delete' width='15px' height='15px' style='margin-left: 4px; border: none;'/></a>";
	   } else {
	   echo "<img src='".$ImageThumb."/".$row_pict['id'].".jpg."."' alt='".$row_pict['id']."' style='margin-left: 7px; margin-top: 7px; border: 3px solid gray; border-radius: 5px; -moz-border-radius: 5px; box-shadow: 2px 3px 3px #000; position: relative; right: -10px;'/>";
	   }
	}
	
	if($_GET['mode']=="delete"){
	?>
	<script type="text/javascript">
		   alert("Успешно Изтриване!");
    </script>
	<?php
	   $delete_img='DELETE FROM images WHERE id='.$_GET['id'].'';
	   $res_delete_img=mysql_query($delete_img);
	   echo '<meta http-equiv="refresh" content="0;url=view_gallery.php?name='.$_GET['name'].'">';
	}
	}
	?>
</div>